
let vertex=/* glsl */`
attribute vec4 apos;
attribute vec4 a_color;
varying vec4 v_color;
uniform vec2 yagl;
void main(){
    float radian = radians(30.0);
    float cos = cos(radian);
    float sin = sin(radian);

    //引用上面的计算数据，创建绕x轴旋转矩阵
    // 1      0       0    0
    // 0   cosα   sinα   0
    // 0  -sinα   cosα   0
    // 0      0        0   1
    mat4 mx = mat4(
        1,  0,      0,      0,  
        0,  cos,    -sin,   0,  
        0,  sin,    cos,    0,  
        0,  0,      0,      1);


    //引用上面的计算数据，创建绕y轴旋转矩阵
    // cosβ   0   sinβ    0
    //     0   1   0        0
    //-sinβ   0   cosβ    0
    //     0   0   0        1
    float sinb = yagl.x;
    float cosb = yagl.y;
    mat4 my = mat4(
        cosb,   0,  -sinb,  0,  
        0,      1,  0,      0,  
        sinb,   0,  cosb,   0,  
        0,      0,  0,      1);

    gl_Position = mx*my*apos;
    v_color = a_color;
}
`;

let fragment = /* glsl */`
precision lowp float;
varying vec4 v_color;
void main(){
    gl_FragColor = v_color;
}
`;

export { vertex, fragment }